from RandomList import GetRandomList

def get_next_gap(gap):
	gap = (gap * 10)//13
	if gap < 1:
		return 1
	return gap

# 梳子排序：一种改进的冒泡法⬆️引入了Gap
def comb_sort(arr):
	n = len(arr)
	gap = n
	swapped = True
	while gap !=1 or swapped:
		gap = get_next_gap(gap)
		swapped = False
		for i in range(0, n-gap):
			if arr[i] > arr[i + gap]:
				arr[i], arr[i + gap]=arr[i + gap], arr[i]
				swapped = True    
    
    
if __name__ == "__main__":
    Arr = GetRandomList(100)
    comb_sort(Arr)
    print(Arr)

